﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZQNB.BaseLib.Core.Models;

namespace ZQNB.BaseLib.Core.Services
{
    public class ProductInfoService : IProductInfoService
    {
        private readonly CoreDataHelper _fileDbHelper;
        public ProductInfoService(CoreDataHelper fileDbHelper)
        {
            _fileDbHelper = fileDbHelper;
        }
        
        public ProductInfo GetProductInfo()
        {
            var theOne = _fileDbHelper.Read<ProductInfo>().SingleOrDefault();
            return theOne;
        }

        public void SaveProductInfo(ProductInfo model)
        {
            var theOnes = new List<ProductInfo> { model };
            _fileDbHelper.Save(theOnes);
        }
    }
}
